import { defineStore } from "pinia";

import {
  getHotSuggests,
  getCategories,
  getHouselist,
} from "@/service/modules/home.js";

const useHomeStore = defineStore("home", {
  state: () => ({
    hotSuggests: [],
    categories: [],
    houseList: [
      {
        discoveryContentType: 9,
        data: {
          iconTag: null,
          productPrice: 290,
          priceTipBadge: {
            type: 0,
            text: "已减￥65",
            color: "#FFFFFF",
            background: null,
            border: null,
            orderIndex: 0,
            tip: null,
            jumpUrl: null,
            colorType: 0,
            gradient: {
              startColor: "#ff6666",
              endColor: "FF9F9F",
            },
      
          },
          houseAdvert: null,
          activityInfo: null,
          sellingPoint: null,
          guideText: null,
          referencePriceDesc: null,
          poiLocation: null,
          houseId: 44173741,
          houseName:
            "踏春出游季·绿野仙踪 情侣静谧情调小窝·智能大屏投影·沙面公园·夜游珠江·朝拜圣心大教堂",
          houseTags: null,
          image: {
            url: "https://image1.cdn.seaart.ai/static/92d87c49ee8b79f1a6655aa165d0f50c/20230420/fce9cea04f5aab508fb4f722550cc744.png",
            width: 360,
            height: 480,
          },
          commentScore: "4.8",
          extendMap:{
              logicBit:"2048"
          },
          summaryText:"整套·1居1床 2人 4.8分",
          showHouseVideo:false,
          cityId:45,
          finalPrice: 45,
          location: "杭州 余杭区"
        },
      },
      {
        discoveryContentType: 9,
        data: {
          iconTag: null,
          productPrice: 290,
          priceTipBadge: {
            type: 0,
            text: "已减￥65",
            color: "#FFFFFF",
            background: null,
            border: null,
            orderIndex: 0,
            tip: null,
            jumpUrl: null,
            colorType: 0,
            gradient: {
              startColor: "#ff6666",
              endColor: "FF9F9F",
            },
      
          },
          houseAdvert: null,
          activityInfo: null,
          sellingPoint: null,
          guideText: null,
          referencePriceDesc: null,
          poiLocation: null,
          houseId: 44173741,
          houseName:
            "踏春出游季·绿野仙踪 情侣静谧情调小窝·智能大屏投影·沙面公园·夜游珠江·朝拜圣心大教堂",
          houseTags: null,
          image: {
            url: "https://image1.cdn.seaart.ai/static/92d87c49ee8b79f1a6655aa165d0f50c/20230420/fce9cea04f5aab508fb4f722550cc744.png",
            width: 360,
            height: 480,
          },
          commentScore: "4.8",
          extendMap:{
              logicBit:"2048"
          },
          summaryText:"整套·1居1床 2人 4.8分",
          showHouseVideo:false,
          cityId:45,
          finalPrice: 45,
          location: "杭州 余杭区"
        },
      },
      {
        discoveryContentType: 9,
        data: {
          iconTag: null,
          productPrice: 290,
          priceTipBadge: {
            type: 0,
            text: "已减￥65",
            color: "#FFFFFF",
            background: null,
            border: null,
            orderIndex: 0,
            tip: null,
            jumpUrl: null,
            colorType: 0,
            gradient: {
              startColor: "#ff6666",
              endColor: "FF9F9F",
            },
      
          },
          houseAdvert: null,
          activityInfo: null,
          sellingPoint: null,
          guideText: null,
          referencePriceDesc: null,
          poiLocation: null,
          houseId: 44173741,
          houseName:
            "踏春出游季·绿野仙踪 情侣静谧情调小窝·智能大屏投影·沙面公园·夜游珠江·朝拜圣心大教堂",
          houseTags: null,
          image: {
            url: "https://image1.cdn.seaart.ai/static/92d87c49ee8b79f1a6655aa165d0f50c/20230420/fce9cea04f5aab508fb4f722550cc744.png",
            width: 360,
            height: 480,
          },
          commentScore: "4.8",
          extendMap:{
              logicBit:"2048"
          },
          summaryText:"整套·1居1床 2人 4.8分",
          showHouseVideo:false,
          cityId:45,
          finalPrice: 45,
          location: "杭州 余杭区"
        },
      },
      {
        discoveryContentType: 9,
        data: {
          iconTag: null,
          productPrice: 290,
          priceTipBadge: {
            type: 0,
            text: "已减￥65",
            color: "#FFFFFF",
            background: null,
            border: null,
            orderIndex: 0,
            tip: null,
            jumpUrl: null,
            colorType: 0,
            gradient: {
              startColor: "#ff6666",
              endColor: "FF9F9F",
            },
      
          },
          houseAdvert: null,
          activityInfo: null,
          sellingPoint: null,
          guideText: null,
          referencePriceDesc: null,
          poiLocation: null,
          houseId: 44173741,
          houseName:
            "踏春出游季·绿野仙踪 情侣静谧情调小窝·智能大屏投影·沙面公园·夜游珠江·朝拜圣心大教堂",
          houseTags: null,
          image: {
            url: "https://image1.cdn.seaart.ai/static/92d87c49ee8b79f1a6655aa165d0f50c/20230420/fce9cea04f5aab508fb4f722550cc744.png",
            width: 360,
            height: 480,
          },
          commentScore: "4.8",
          extendMap:{
              logicBit:"2048"
          },
          summaryText:"整套·1居1床 2人 4.8分",
          showHouseVideo:false,
          cityId:45,
          finalPrice: 45,
          location: "杭州 余杭区"
        },
      },
    ],
  }),
  actions: {
    async fetchHotSuggestData() {
      const res = await getHotSuggests();
      this.hotSuggests = res.data;
    },
    async fetchCategoriesData() {
      const res = await getCategories();
      this.categories = res.data;
    },
    async fetchHouselistData() {
    //   const res = await getHouselist();
    for (let i = 0; i < 4; i++) {
      this.houseList.push({
        discoveryContentType: 9,
        data: {
          iconTag: null,
          productPrice: 290,
          priceTipBadge: {
            type: 0,
            text: "已减￥65",
            color: "#FFFFFF",
            background: null,
            border: null,
            orderIndex: 0,
            tip: null,
            jumpUrl: null,
            colorType: 0,
            gradient: {
              startColor: "#ff6666",
              endColor: "FF9F9F",
            },
      
          },
          houseAdvert: null,
          activityInfo: null,
          sellingPoint: null,
          guideText: null,
          referencePriceDesc: null,
          poiLocation: null,
          houseId: 44173741,
          houseName:
            "踏春出游季·绿野仙踪 情侣静谧情调小窝·智能大屏投影·沙面公园·夜游珠江·朝拜圣心大教堂",
          houseTags: null,
          image: {
            url: "https://image1.cdn.seaart.ai/static/92d87c49ee8b79f1a6655aa165d0f50c/20230420/fce9cea04f5aab508fb4f722550cc744.png",
            width: 360,
            height: 480,
          },
          commentScore: "4.8",
          extendMap:{
              logicBit:"2048"
          },
          summaryText:"整套·1居1床 2人 4.8分",
          showHouseVideo:false,
          cityId:45,
          finalPrice: 45,
          location: "杭州 余杭区"
        },
      })
    }
    },
  },
});
export default useHomeStore;
